#ifndef __DOUBLE_HASH_MAP_TEST_H__
#define __DOUBLE_HASH_MAP_TEST_H__

#pragma once

#include "TestSystem.h"
#include "Utilities.h"

namespace Nezha
{

	struct TestDHMapSt
	{
		int nn;
		int mm;

		TestDHMapSt()
			:nn(0), mm(0)
		{
		}
	};

	struct FastLessCompare
	{
		bool operator() (const _string& a, const _string& b) const
		{
			const size_t la = a.length();
			const size_t lb = b.length();
			if (la == lb)
				return (memcmp(a.c_str(), b.c_str(), la*sizeof(char)) < 0);
			return (la < lb);
		}
	};



	class DoubleHashMapTest : public NZTest
	{
	public:
		DoubleHashMapTest(const _string& name)
			:NZTest(name)
			,mSteps(0)
		{
		}

		~DoubleHashMapTest();

		virtual bool initialize();

		virtual void reset();

		virtual bool updateImpl(float dt);

		virtual void uninitialize();

		DoubleLayersHashMap<TestDHMapSt, _string, DefStrDoubleHashFunctor> mMap;

		PArray<_string> mNames4Test;
		PArray<TestDHMapSt> mSt4Test;

		typedef PMap<_string, TestDHMapSt, FastLessCompare> StdNameValMap;
		//typedef PMap<_string, TestDHMapSt> StdNameValMap;
		StdNameValMap mStdMap; // for comparison

		int mSteps;
	};

}//end namespace Nezha


#endif //end __DOUBLE_HASH_MAP_TEST_H__